﻿/*!
* File Name:        ready.js
* Created When:     2012-05-29
* Created by:       陈鹏
* Created Whys:      页面加载   
*/






//页面加载事件
$(document).ready(function () {

    // goToPage(6);
    /*Init--Begin--*/
    //接受来源参数
    var sources = "";
    var surce = Request.QueryString('source');
    //alert("source:" + surce);
    var utm_source = Request.QueryString('utm_source');
    //alert("utm_source:" + utm_source);
    var utm_medium = Request.QueryString('utm_medium');
    //alert("utm_medium:" + utm_medium);
    var utm_campaign = Request.QueryString('utm_campaign');
    //alert("utm_campaign:" + utm_campaign);
    //    if (surce != null)
    //        sources = surce;
    //    if (utm_source != null)
    //        sources = utm_source;
    //    if (utm_medium != null)
    //        sources = utm_medium;
    //    if (utm_campaign != null)
    //        sources = utm_campaign;
    //alert("sources:" + sources);
    $('#hid_source').val(utm_source);
    $('#hid_medium').val(utm_medium);
    $('#hid_campaign').val(utm_campaign);

    //alert("隐藏" + $('#hid_source').val());
    //初始化 省份
    //    var proStr = GetProvince();
    //    $('#pro').append(proStr);

    //alert(source);
    /*Init--End--*/

    /*Event*/


    $('#type12').change(function () {
        $('#type14').val(0);
        $('#font_id').html("");
        if ($('#type12').val() == "0")
            $('#font_id').html("");
        else
            $('#font_id').html("您选定的车型为甲壳虫: 1.2TSI " + $('#type12').val());


        //        var capcity = "";
        //        var html = $('.bPic ul');
        //        html.html("");

        $('#hid_colorType').val("");
        $('#hid_colorValue').val("");
        $('#hid_seat').val("");
        $('#hid_img').val("");
        $('#hid_Viewimg').val("");
        $("#hid_colorImgId").val("");
        var anchors = document.getElementsByTagName("a");
        for (var i = 0; i < anchors.length; i++) {
            if (anchors[i].className.toLowerCase() == 'current') {
                anchors[i].className = "";
            }
        }
        $('#zhenghei').attr("class", "current");

        $('#selectNs').html('');

    })
    $('#type14').change(function () {
        $('#type12').val(0);
        $('#font_id').html("");
        if ($('#type14').val() == "0")
            $('#font_id').html("");
        else
            $('#font_id').html("您选定的车型为甲壳虫: 1.4TSI " + $('#type14').val());
        $("#hid_colorImgId").val("");
        $('#hid_colorType').val("");
        $('#hid_colorValue').val("");
        $('#hid_seat').val("");
        $('#hid_img').val("");
        $('#hid_Viewimg').val("");

        var anchors = document.getElementsByTagName("a");
        for (var i = 0; i < anchors.length; i++) {
            if (anchors[i].className.toLowerCase() == 'current') {
                anchors[i].className = "";
            }
        }

        $('#zhenghei').attr("class", "current");

        $('#selectNs').html('');
    })

    //省份改变事件
    $('#pro').change(function () {
        //alert('省份改变');
        var pid = $('#pro').val();
        //alert("pid:" + pid);
        if (pid != "0") { //获取城市
            var cityStr = GetCity(pid);
            $('#city').html("<option value=\"0\">请选择</option>");
            $('#city').append(cityStr);
        }
    })

    //城市改变事件
    $('#city').change(function () {
        var cid = $('#city').val();
        if (cid != "0") { //获取经销商
            var dealerStr = GetDealer(cid)
            $('#dealer').html("<option value=\"0\">请选择</option>");
            $('#dealer').append(dealerStr);
        }
    })

});